<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="com.control.UserControl" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">
<title>检查登录</title>
</head>
<body>
<%
String username=request.getParameter("username");
String password=request.getParameter("password");
UserControl lc=new UserControl();
int type = lc.isUser(username, password);
if(type > 0)
{
	//System.out.println("你好！");
	session.setAttribute("username",username);
    session.setAttribute("password",password);
    session.setAttribute("id",lc.getUserId(username,password));
    if(type == 2)
		response.sendRedirect("manager_login.jsp");
	if(type == 3)
		response.sendRedirect("teacher_login.jsp");
	if(type == 4)
		response.sendRedirect("student_login.jsp");
}
else
{
	 %>
	  <script language="javascript">
				alert("密码错误！");
				window.location.href="login.jsp"
			</script>
	 <%
}
%>
</body>
</html>